﻿using UnityEngine;
using System.Collections;

public class ShockDice : MonoBehaviour {
	public GameObject Dice1 = null;
	public GameObject Dice2 = null;
	public GameObject Dice3 = null;
	public GameObject Dice4 = null;
	public GameObject Dice5 = null;
	public GameObject Dice6 = null;
	// Use this for initialization
	void Start () {
	
	}

	// Update is called once per frame
	void Update () {
		Vector3 vecTest = Input.acceleration * 50;
		vecTest.z = 0;
		Dice1.GetComponent<Rigidbody>().AddForce(vecTest);
		Dice2.GetComponent<Rigidbody>().AddForce(vecTest);
		Dice3.GetComponent<Rigidbody>().AddForce(vecTest);
		Dice4.GetComponent<Rigidbody>().AddForce(vecTest);
		Dice5.GetComponent<Rigidbody>().AddForce(vecTest);
		Dice6.GetComponent<Rigidbody>().AddForce(vecTest);
	}

	void OnGUI(){
		GUI.Label(new Rect(0,0,480,100),"Pos is " +Input.acceleration * 50);
	}
}
